<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>首页</h1>
<h1 th:text="${msg}"></h1>

<div th:if="${session.user} != null">
    <h2>欢迎<span th:text="${session.user.name}"></span>
        <a th:href="@{/logout}">退出</a>
    </h2>
</div>

<div shiro:notAuthenticated="">
    <a th:href="@{/toLogin}">登录</a>
</div>

<p shiro:user="">
    用户信息：
    <shiro:principal/>
</p>
<p shiro:hasRole="admin">你好，管理员</p>
<p shiro:hasRole="root">你好，超级管理员</p>
<p shiro:hasRole="user">你好，普通用户</p>
<a shiro:user="" th:href="@{/logout}">注销</a>
<hr/>
<!--<div shiro:hasPermission="user:add">
    <a th:href="@{/user/add}">add</a>
</div>

<div shiro:hasPermission="user:update">
    <a th:href="@{/user/update}">update</a>
</div>-->

<div shiro:hasAnyPermissions="user:add, user:*">
    <a th:href="@{/user/add}">add</a>
</div>

<div shiro:hasAnyPermissions="user:update,user:*">
    <a th:href="@{/user/update}">update</a>
</div>


</body>
</html>